<?php

namespace App\Models;

use Encore\Admin\Traits\AdminBuilder;
use Encore\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\Model;

/**
 * Class Typeoption
 * @package App\Models
 * @mixin \Eloquent
 */
class Typeoption extends Model
{
    use ModelTree, AdminBuilder;

    protected $table = 'typeoption';

    protected $casts = [
        'rules' => 'json',
        'expiration' => 'json',
    ];
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        //$this->setTitleColumn('name');
    }

    public static function getType()
    {
        return [
            '1' => '分类A',
            '2' => '分类B',
            '3' => '分类C',
            '4' => '分类D',
            '5' => '分类E',
            '6' => '分类F',
        ];
    }

    public static function getFieldType()
    {
        return [
            'number' => '数字(number)',
            'text' => '字串(text)',
            'radio' => '单选(radio)',
            'checkbox' => '多选(checkbox)',
            'textarea' => '文本(textarea)',
            'select' => '选择(select)',
            'image' => '上传图片(image)',
            'images' => '图片组(images)',
            'model' => '模型关联(model)',
        ];
    }
}
